<?php
/**
 * 下面代码实现把demo目录压缩成zip包，并以demo.zip为名称存储到folder目录
 */
include_once "./MakeZip.class.php";
$makeZip = new MakeZip();
try{
    //重复压缩，则会自动覆盖
    $res = $makeZip->zip('./demo/','./folder/demo.zip');
    if(!$res){
        throw new Exception('压缩失败');
    }
    echo 'success';
}catch (Exception $e){
    echo $e->getMessage();
}